package com.msb.dp.singleton;

/**
 * @Auther: Huanyu Lee
 * @Date: 2022/3/2  22:34
 * @Description: 懒汉式
 * 优点：达到了按需初始化的目的
 * 缺点：线程不安全
 */
public class Mgr02 {
    private static Mgr02 INSTANCE;
    private Mgr02(){};
    public static Mgr02 getInstance() {
        if (INSTANCE == null) {
            try {
                Thread.sleep(1);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            INSTANCE = new Mgr02();
        }
        return INSTANCE;
    }
}
